﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WikiQuizz.Common.Resource;

namespace WikiQuizz.Common.Entities
{
    /// <summary>
    /// This entity holds extracted information from the "Infobox country"
    /// </summary>
    public class CountryEntity: WikiPageEntity
    {
        /// <summary>
        /// Extracted name of the capital.
        /// </summary>
        public string Capital { get; set; }

        /// <summary>
        /// Extracted population.
        /// </summary>
        public string Population { get; set; }

        /// <summary>
        /// Extracted population density.
        /// </summary>
        public string PopulationDensity { get; set; }

        /// <summary>
        /// At least one extracted official language.
        /// </summary>
        public string OfficialLanguage { get; set; }
        
        /// <summary>
        /// Extracted area data.
        /// </summary>
        public string Area { get; set; }

        /// <summary>
        /// Extracted ISO 3166 code
        /// </summary>
        /// <example>"D" for Germany or "GB" for United Kingdom</example>
        
        public string ISO3166 { get; set; }

        /// <summary>
        /// Is every property different from "error"?
        /// </summary>
        public override bool IsValid
        {
            get
            {
                return !Capital.Equals(Strings.ERROR)
                    && !Population.Equals(Strings.ERROR)
                    && !PopulationDensity.Equals(Strings.ERROR)
                    && !Area.Equals(Strings.ERROR)
                    && !OfficialLanguage.Equals(Strings.ERROR);
            }
        }
    }
}
